﻿using System.Collections.Generic;
using GuRenFang.Service.Entity;
using GuRenFang.Service.IBiz;
using GuRenFang.Service.IDa;

namespace GuRenFang.Biz
{
   public class ContentInfoBiz:IContentInfoBiz
    {
       private readonly IContentInfoRepository _repository;
        private readonly ICommit _commitAble;
        public ContentInfoBiz(IContentInfoRepository repository, ICommit commitAable)
        {
            this._repository = repository;
            this._commitAble = commitAable;
        }


       public IEnumerable<ContentInfo> GetAll()
       {
           throw new System.NotImplementedException();
       }

       public ContentInfo GetById(int id)
       {
           throw new System.NotImplementedException();
       }

       public void Create(ContentInfo item)
       {
           _repository.Add(item);
           Save();
       }

       public void Update(ContentInfo item)
       {
           _repository.Update(item);
           Save();
       }

       public void Delete(int id)
       {
           var news = _repository.GetById(id);
           _repository.Delete(news);
           Save();
       }

       public void Save()
       {
           _commitAble.Commit();
       }

       public TipsInfo GetTipsInfo()
       {
           return _repository.GetTipsInfo();
       }

       public CompanyInfo GetCompanyInfo()
       {
           return _repository.GetCompanyInfo();
       }
    }
}
